package wli.app.util;

public class MyTrinaryTree {

	public void insert(Directory dir, String path) {

		if (value < node.value) {
			if (node.left != null) {
				insert(node.left, value);
			} else {
				System.out.println(" Inserted " + value + " to left of "
						+ node.value);
				node.left = new NodeStructure(value);
				node.left.parent = node;
			}
		} else if (value > node.value) {
			if (node.right != null) {
				insert(node.right, value);
			} else {
				if (node.value > 0)
					System.out.println(" Inserted " + value + " to right of "
							+ node.value);
				else
					System.out.println(" Created root node " + value);
				node.right = new NodeStructure(value);
				if (node.value > 0)
					node.right.parent = node;
			}
		} else if (path == dir.path) {
			if (node.middle != null) {
				insert(node.middle, value);
			} else {
				System.out.println(" Inserted " + value + " to middle of "
						+ node.value);
				node.middle = new NodeStructure(value);
				node.middle.parent = node;
			}
		}
	}
}
